package main

import "fmt"

// Author : CSR丶WARRIOR
// Time ： 2020/10/13  22:17
// TOOLS : GoLand
// FILENAME : copySlice.go
// STATEMENT: 

func main() {
	testCopy1()
}

func testCopy1() {
	var a []int = []int{4, 5, 6, 7, 8}
	b := []int{2, 3}
	copy(b, a)
	fmt.Println(b) //[4 5],a的元素覆盖了b的元素
}
func testCopy2() {
	var a []int = []int{4, 5, 6, 7, 8}
	b := []int{1, 2}
	copy(a, b)
	fmt.Println(a) //[1 2 6 7 8]，b的元素覆盖了a中的元素
}
